<div class="container">
    <email-settings-warning function="invite emails"></email-settings-warning>
    <users-nav></users-nav>

    <form class="form" name="userForm" ng-submit="saveUser()" novalidate>
        <div class="form-group required" show-errors>
            <label class="control-label">Name</label>
            <input type="text" name="name" class="form-control" ng-model="user.name" ng-disabled="user.created" required/>
            <input-errors name="Name" errors="userForm.name.$error"/>
        </div>
        <div class="form-group required" show-errors>
            <label class="control-label">Email</label>
            <input name="email" type="email" class="form-control" ng-model="user.email" ng-disabled="user.created" required/>
            <input-errors name="Email" errors="userForm.email.$error"/>
        </div>

        <div class="form-group" ng-if="!user.created">
            <button class="btn btn-primary">Create</button>
        </div>

        <div ng-if="user.created" class="alert alert-success">
            <p>
                <strong>The user has been created and should receive an invite email soon.</strong>
            </p>
            <p>
                You can use the following link to invite them yourself:<br/>
                {{user.invite_link}}
            </p>
        </div>
    </form>
</div>
